/**
*  
* @Function 数据催收定时任务 
* @ProjectName credit-data-platform 
* @PackageName com.py.credit.controller    
* @FileName DataRemindController.java    
* @Date 2018年5月11日下午5:06:41
* @Author Min DongXv
* @Copyright (c) 2018, 金电联行 All Rights Reserved.   
*   
*/  
package com.py.credit.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.py.credit.common.logs.ExceptionLogger;
import com.py.credit.common.rest.RestServiceResult;
import com.py.credit.service.TaskRemindService;

/**
 * 
 * @Function 数据催收定时任务
 * @ClassName DataRemindController
 * @Date 2018年5月11日 下午5:06:41
 * @Author Min DongXv
 * 
 */
@RestController
@RequestMapping(value = "/dataRemind")
public class DataRemindController extends BaseController {

	@Autowired
	private TaskRemindService taskRemindService;

	/**
	 * 
	 * @api {get} /dataRemind/taskRemind.json 任务提醒定时任务
	 * @apiName taskRemind
	 * @apiVersion 0.0.1
	 * @apiGroup 数据催收
	 */
	@RequestMapping(value = "/taskRemind.do")
	public RestServiceResult<Object> taskRemind() {
		try {
			taskRemindService.dataRemind(7, "T");
			return new RestServiceResult<Object>();
		} catch (Exception e) {
			RestServiceResult<Object> result = new RestServiceResult<Object>();
			result.setCode(RestServiceResult.CODE_UNKNOW);
			result.setMsg("任务提醒定时任务异常！ERROR:" + e.getMessage());
			ExceptionLogger.error("任务提醒定时任务DataRemindController#taskRemind", "任务提醒定时任务异常！ERROR:" + e.getMessage(), e);
			return result;
		}
	}

	/**
	 * 
	 * @api {get} /dataRemind/dataRemind.json 数据催收定时任务
	 * @apiName DataRemind
	 * @apiVersion 0.0.1
	 * @apiGroup 数据催收
	 */
	@RequestMapping(value = "/dataRemind.do")
	public RestServiceResult<Object> dataRemind() {
		try {
			taskRemindService.dataRemind(0, "C");
			return new RestServiceResult<Object>();
		} catch (Exception e) {
			RestServiceResult<Object> result = new RestServiceResult<Object>();
			result.setCode(RestServiceResult.CODE_UNKNOW);
			result.setMsg("数据催收定时任务异常！");
			ExceptionLogger.error("数据催收定时任务DataRemindController#dataRemind", "数据催收定时任务异常！ERROR:" + e.getMessage(), e);
			return result;
		}
	}

	/**
	 * 
	 * @api {get} /dataRemind/dataUnfinishRemind.do 定时任务-部门绩效统计未完成催收
	 * @apiName dataUnfinishRemind
	 * @apiVersion 0.0.1
	 * @apiGroup 数据催收
	 * @apiSuccess {String} code 状态码:1 成功 -1 失败
	 * @apiSuccess {String} msg 错误信息
	 * @apiSuccess {int} count 结果集数据量
	 * @apiSuccess {Object} data 结果集
	 */
	@RequestMapping(value = "/dataUnfinishRemind.do")
	public RestServiceResult<Object> dataUnfinishRemind() {
		try {
			taskRemindService.dataUnfinishRemind();
			return new RestServiceResult<Object>();
		} catch (Exception e) {
			RestServiceResult<Object> result = new RestServiceResult<Object>();
			result.setCode(RestServiceResult.CODE_UNKNOW);
			result.setMsg("定时任务-部门绩效统计未完成催收异常！");
			ExceptionLogger.error("DataRemindController#dataUnfinishRemind",
					"定时任务-部门绩效统计未完成催收异常！ERROR:" + e.getMessage(), e);
			return result;
		}
	}
}
